#include "ET++.ph"
#ifdef __GNUG__
#pragma implementation
#endif

#include "Filler.h"

#include "Class.h"

//---- Filler ------------------------------------------------------------------

NewMetaImpl(Filler,VObject, (T(minsize), TP(ink)));

Filler::Filler(const Point &e, int f) : ink(gInkNone), minsize(e), VObject(e)
{
	SetFlag(f & (eVObjHFixed | eVObjVFixed));
}

Filler::Filler(const Point &e, Ink *i, int f) : ink(i), minsize(e), VObject(e) 
{
	SetFlag(f & (eVObjHFixed | eVObjVFixed));
}

Metric Filler::GetMinSize()
{
	return Metric(minsize);
}

void Filler::Draw(Rectangle r)
{
	if (ink != ePatNone)
		GrPaintRect(r, ink);
}

Ink *Filler::SetInk(Ink *ik, bool redraw)
{
	Ink *oldink= ink;
	ink= ik;
	if (redraw)
		ForceRedraw();
	return oldink;
}

OStream& Filler::PrintOn(OStream &s)
{
	VObject::PrintOn(s);
	return s << minsize SP << ink SP;
}

IStream& Filler::ReadFrom(IStream &s)
{
	VObject::ReadFrom(s);
	return s >> minsize >> ink;
}

